using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace RetailAnalytic.Core
{
    public partial class FrmDialog : frmTemplate
    {
        private Dictionary <ButtonDialog,Infragistics.Win.Misc.UltraButton> ListButton = new Dictionary<ButtonDialog,Infragistics.Win.Misc.UltraButton>();
        public ButtonDialog _ButtonClick;
        public FrmDialog()
        {
            InitializeComponent();
            SetGuiAppearance();
            ListButton.Add(ButtonDialog.Button_yes, button_yes);
            ListButton.Add(ButtonDialog.Button_no, button_no);
            ListButton.Add(ButtonDialog.Button_cancel, button_cancel);
            ListButton.Add(ButtonDialog.Button_close, button_close);
            button_no.Click += delegate { Click(ButtonDialog.Button_no); };
            button_close.Click += delegate { Click(ButtonDialog.Button_close); };
            button_cancel.Click += delegate { Click(ButtonDialog.Button_cancel); };
            button_yes.Click += delegate { Click(ButtonDialog.Button_yes); };
            button_yes.Hide();
            button_no.Hide();
            button_cancel.Hide();
            button_close.Hide();
        }
        public bool ShowCheckSession
        {
            set
            {
                this.cb_sess.Visible = value;
            }
        }
        private void SetGuiAppearance()
        {
            imageList1.Images.Add("0", SR.ImagesLibrary.GetImageByName("error_32"));
            imageList1.Images.Add("1", SR.ImagesLibrary.GetImageByName("help"));
            imageList1.Images.Add("2", SR.ImagesLibrary.GetImageByName("about"));
            imageList1.Images.Add("3", SR.ImagesLibrary.GetImageByName("apply"));
        }

        private void ultraButton1_Click(object sender, EventArgs e)
        {
            Close();
        }
        public void Click(ButtonDialog bd)
        {
            _ButtonClick = bd;
            this.Close();
        }
        public void InitGuiDialog(DialogTypes _dialogTypes,string textMessage)
        {
            this.Text = _dialogTypes.DialogTitle;
            this.upb_status.Image = imageList1.Images[(int)_dialogTypes.dialogType];
            this.ute_message.Text = textMessage;
        }
        public void InitGuiDialog(DialogTypes _dialogTypes, string textMessage,ButtonDialog [] paramButtons)
        {
            for (int i = 0; i < paramButtons.Length ; i++)
            {
                //ListButton[paramButtons[i]].Visible = true;
                ListButton[paramButtons[i]].Show();
            }
            this.Text = _dialogTypes.DialogTitle;
            this.upb_status.Image = imageList1.Images[(int)_dialogTypes.dialogType];
            this.ute_message.Text = textMessage;
        }
        private void ultraButton1_Click_1(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
